package p2p.simulator.gui;

import java.awt.Rectangle;

/*
 * StatusBar.java
 *
 * Created on June 2, 2008, 10:59 PM
 */



/**
 *
 * @author  papalukg
 */
public class StatusBar extends javax.swing.JPanel {
    
    private boolean isReady;
    
    /** Creates new form StatusBar */
    public StatusBar() {
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        statusLabel = new javax.swing.JLabel();

        setBorder(new javax.swing.border.LineBorder(new java.awt.Color(155, 166, 191), 1, true));
        setMaximumSize(new java.awt.Dimension(100, 20));
        setMinimumSize(new java.awt.Dimension(100, 20));

        statusLabel.setPreferredSize(new java.awt.Dimension(400, 20));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
    }// </editor-fold>//GEN-END:initComponents
    
    public void updateStatusLabel (String str) {
        
        statusLabel.setText(str);
        Rectangle progressRect = getBounds();
        progressRect.x = 0;
        progressRect.y = 0;
        paintImmediately(progressRect);
    }
    
    public boolean isReady() { return isReady; }
    
    public void setReady(boolean b) { isReady = b; }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel statusLabel;
    // End of variables declaration//GEN-END:variables
    
}
